<?php
	//phpinfo();
	include "./funcs/dbfunctions.inc";
	session_start();
	$db = new mysqli("127.0.0.1","fc","keks");
	if(mysqli_connect_errno($db))
	{
		die("failed to Connect to Database: ". mysqli_connect_error());
	}

	//mysql_select_db("wottools") or logToFile("cannot select db") or die ("cannot select db");
	
	if(!(isset($_SESSION['userid'])))
	{
		$_SESSION['userid']=1;
	}
	$userid = $_SESSION['userid'];
	$target = $_SERVER["SCRIPT_NAME"];
	
	
	
	if(!(canAccess($db, $userid,$target)))
	{
		die("permission denied");
	}
?>